package cn.itcast.n2.util;

import java.util.concurrent.TimeUnit;

/**
 * className: Sleeper
 * description:
 * date: 2023/2/13-15:31
 * <p>
 * project: concurrent
 * package: cn.itcast.n2.util
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
public class Sleeper {

    public static void sleep(int i) {
        try {
            TimeUnit.SECONDS.sleep(i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void sleep(double i) {
        try {
            TimeUnit.MILLISECONDS.sleep(((int) (i * 1000)));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
